<?php

// @formatter:off
/**
 * @file WCActiveTagHook.abs.php
 * @author Alejandro Dario Simi
 * @date $Date: 2014-05-04 01:33:52 +0000 (Sun, 04 May 2014) $
 *
 * $Id: WCActiveTagHook.abs.php 111 2014-05-04 01:33:52Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/trunk/includes/activetags/WCActiveTagHook.abs.php $
 */
// @formatter:on

/**
 * @abstract
 * @class WCActiveTagHook
 */
abstract class WCActiveTagHook {
	protected $_canIt = array(
		"add" => array(
			"CL" => true,
			"CX" => true,
			"DI" => true,
			"IM" => true,
			"TA" => true
		),
		"remove" => array(
			"CL" => true,
			"CX" => true,
			"DI" => true,
			"IM" => true,
			"TA" => true,
			"ALL" => true
		)
	);
	protected $_canBeAdded = false;
	protected $_canBeRemoved = false;
	protected $_tag = false;
	public function __construct() {
		$this->buildBasics();
	}
	//
	// Public methods.
	public function canBeAdded() {
		return $this->_canBeAdded;
	}
	public function canBeAddedCL() {
		return $this->_canIt["add"]["CL"];
	}
	public function canBeAddedCX() {
		return $this->_canIt["add"]["CX"];
	}
	public function canBeAddedDI() {
		return $this->_canIt["add"]["DI"];
	}
	public function canBeAddedIM() {
		return $this->_canIt["add"]["IM"];
	}
	public function canBeAddedTA() {
		return $this->_canIt["add"]["TA"];
	}
	public function canBeRemoved() {
		return $this->_canBeRemoved;
	}
	public function canBeRemovedALL() {
		return $this->_canIt["remove"]["ALL"];
	}
	public function canBeRemovedCL() {
		return $this->_canIt["remove"]["CL"];
	}
	public function canBeRemovedCX() {
		return $this->_canIt["remove"]["CX"];
	}
	public function canBeRemovedDI() {
		return $this->_canIt["remove"]["DI"];
	}
	public function canBeRemovedIM() {
		return $this->_canIt["remove"]["IM"];
	}
	public function canBeRemovedTA() {
		return $this->_canIt["remove"]["TA"];
	}
	public function hasCronTasks() {
		return false;
	}
	public function hasWebAddTasks() {
		return false;
	}
	public function hasWebRemoveTasks() {
		return false;
	}
	public function runCronTasks($spacer = "") {
		return false;
	}
	public function runWebAddTasks() {
		return false;
	}
	public function runWebRemoveTasks() {
		return false;
	}
	public function setTag(WCTag &$tag) {
		$this->_tag = $tag;
		return $this->tag();
	}
	/**
	 * @return WCTag
	 */
	public function tag() {
		return $this->_tag;
	}
	//
	// Protected methods.
	protected function buildBasics() {
		foreach($this->_canIt["add"] as $key => $value) {
			if(($this->_canBeAdded = $this->_canBeAdded || $value)) {
				break;
			}
		}
		foreach($this->_canIt["remove"] as $key => $value) {
			if(($this->_canBeRemoved = $this->_canBeRemoved || $value)) {
				break;
			}
		}
	}
}
